<?php

/**
 * Created by PhpStorm.
 * Author: ls
 * Time: 2023/8/7 10:55
 * Desc:订单状态变更订单监听
 */

class Listener_Order_StatusChanged_OrderListener extends Listener_Base
{

    public function handle($args)
    {
        $self       = new self();
        $self->args = $args;
        if ($self->queue_status) {
            Queue::in('default', Listener_Order_StatusChanged_OrderListener::class, $args);
        } else {
            $self->perform();
        }
    }

    public function perform()
    {
        $order = $this->args['order'] ?? $this->args;
        if (isset($order['ordersn'])) {
            // 订单监听
            Model_Member_Order_listener::detect($order['ordersn']);
            St_Log::write('订单监听', array('ordersn' => $order['ordersn']), 'event/order_changed/log');
        }
    }

}